/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50717
 Source Host           : localhost
 Source Database       : zzuicu

 Target Server Type    : MySQL
 Target Server Version : 50717
 File Encoding         : utf-8

 Date: 07/30/2018 17:13:55 PM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `family`
-- ----------------------------
DROP TABLE IF EXISTS `family`;
CREATE TABLE `family` (
  `family_id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(22) DEFAULT NULL,
  `name` varchar(22) DEFAULT NULL,
  PRIMARY KEY (`family_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
--  Records of `family`
-- ----------------------------
BEGIN;
INSERT INTO `family` VALUES ('1', '3', null), ('2', 'qqq', 'qwq');
COMMIT;

-- ----------------------------
--  Table structure for `machine`
-- ----------------------------
DROP TABLE IF EXISTS `machine`;
CREATE TABLE `machine` (
  `machine_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '器械id',
  `machine_num` int(11) NOT NULL AUTO_INCREMENT COMMENT '器械num（pk）',
  `physician_id` bigint(20) DEFAULT NULL COMMENT '医生编号（pk）',
  `machine_type` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '器械型号',
  `machine_status` tinyint(4) DEFAULT NULL COMMENT '器械状态（0 close,1 open,2 alarm）',
  PRIMARY KEY (`machine_num`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
--  Table structure for `machine_t`
-- ----------------------------
DROP TABLE IF EXISTS `machine_t`;
CREATE TABLE `machine_t` (
  `machine_trainin_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '训练id',
  `machine_num` int(11) DEFAULT NULL COMMENT '器械num',
  `machine_traininglong` double DEFAULT NULL COMMENT '器械使用时间',
  `machine_trainingvideo` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '器械监控地址',
  `machine_trainingtime` datetime DEFAULT NULL COMMENT '器械监控时间',
  PRIMARY KEY (`machine_trainin_id`),
  KEY `machine_index` (`machine_trainin_id`,`machine_num`,`machine_traininglong`,`machine_trainingvideo`,`machine_trainingtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
--  Table structure for `patient`
-- ----------------------------
DROP TABLE IF EXISTS `patient`;
CREATE TABLE `patient` (
  `patient_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '患者id（pk）',
  `name` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '患者名',
  `patient_casenum` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '患者病例号',
  `patient_disease` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '患者疾病类型',
  `patient_sex` tinyint(4) DEFAULT NULL COMMENT '患者性别',
  `patient_height` smallint(6) DEFAULT NULL COMMENT '患者身高',
  `patient_weight` smallint(6) DEFAULT NULL COMMENT '患者姓名',
  `patient_age` smallint(6) DEFAULT NULL COMMENT '患者年龄',
  `patient_training_date` datetime DEFAULT NULL COMMENT '患者最近康复日期',
  `username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `physician_id` int(11) DEFAULT NULL,
  `physician` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`patient_id`),
  UNIQUE KEY `patient_casenum` (`patient_casenum`),
  KEY `patient_index` (`patient_id`,`name`,`patient_casenum`,`patient_disease`,`patient_sex`,`patient_height`,`patient_weight`,`patient_age`,`patient_training_date`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
--  Records of `patient`
-- ----------------------------
BEGIN;
INSERT INTO `patient` VALUES ('5', 'qwq', null, null, null, null, null, null, null, 'qqq', '5', null), ('6', 'qwq', null, null, null, null, null, null, null, 'qqq', '5', null), ('7', 'qwq', null, null, null, null, null, null, null, 'zz233q', '5', null), ('8', 'qwq', null, null, null, null, null, null, null, '4zz233q', '5', null), ('9', 'qwq', null, null, null, null, null, null, null, '4zz2333q', null, null);
COMMIT;

-- ----------------------------
--  Table structure for `patient_tm`
-- ----------------------------
DROP TABLE IF EXISTS `patient_tm`;
CREATE TABLE `patient_tm` (
  `patient_id` bigint(20) NOT NULL COMMENT '患者id',
  `patient_trainingid` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '训练报表id pk',
  `patient_heartrate` smallint(6) DEFAULT NULL COMMENT '患者心率',
  `patient_respiratoryrate` smallint(6) DEFAULT NULL COMMENT '患者呼吸速率',
  `patient_myoelectricity` double DEFAULT NULL COMMENT '患者肌电',
  `patient_presure` double DEFAULT NULL COMMENT '患者压力',
  `patient_trainingtime` datetime NOT NULL COMMENT '患者训练时间点',
  `machine_id` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '训练机器id',
  PRIMARY KEY (`patient_trainingid`),
  KEY `patient_training_message_index` (`patient_id`,`patient_heartrate`,`patient_respiratoryrate`,`patient_trainingid`,`patient_myoelectricity`,`patient_presure`,`patient_trainingtime`,`machine_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
--  Records of `patient_tm`
-- ----------------------------
BEGIN;
INSERT INTO `patient_tm` VALUES ('5', '1', '1', '1', '1', '1', '2018-07-23 14:32:52', '1');
COMMIT;

-- ----------------------------
--  Table structure for `patient_tmavg`
-- ----------------------------
DROP TABLE IF EXISTS `patient_tmavg`;
CREATE TABLE `patient_tmavg` (
  `patient_id` bigint(20) NOT NULL COMMENT '患者id',
  `patient_trainingid` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '训练报表id pk',
  `patient_heartrate` smallint(6) DEFAULT NULL COMMENT '患者心率',
  `patient_respiratoryrate` smallint(6) DEFAULT NULL COMMENT '患者呼吸速率',
  `patient_myoelectricity` double DEFAULT NULL COMMENT '患者肌电',
  `patient_presure` double DEFAULT NULL COMMENT '患者压力',
  `patient_trainingtime` datetime NOT NULL COMMENT '患者训练时间点',
  `machine_id` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '训练机器id',
  PRIMARY KEY (`patient_trainingid`),
  KEY `patient_training_message_index` (`patient_id`,`patient_heartrate`,`patient_respiratoryrate`,`patient_trainingid`,`patient_myoelectricity`,`patient_presure`,`patient_trainingtime`,`machine_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
--  Records of `patient_tmavg`
-- ----------------------------
BEGIN;
INSERT INTO `patient_tmavg` VALUES ('1', '1', '1', '1', '1', '1', '2018-07-23 14:35:07', '1');
COMMIT;

-- ----------------------------
--  Table structure for `physician`
-- ----------------------------
DROP TABLE IF EXISTS `physician`;
CREATE TABLE `physician` (
  `physician_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '医生编号（pk）',
  `physician_authority` tinyint(4) DEFAULT NULL COMMENT '医生权限（1-5）依次升高0是管理员',
  `physician_logintime` datetime DEFAULT NULL COMMENT '医生登录时间',
  `username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `name` varchar(22) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`physician_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
--  Records of `physician`
-- ----------------------------
BEGIN;
INSERT INTO `physician` VALUES ('5', null, '2018-07-30 16:35:22', 'zzq', 'qwq'), ('6', null, '2018-07-30 16:36:31', 'zz2q', 'qwq');
COMMIT;

-- ----------------------------
--  Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `u_id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `role` varchar(255) DEFAULT NULL,
  `active` varchar(255) DEFAULT NULL,
  `account` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`u_id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
--  Records of `user`
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES ('11', 'qqq', '11', '1', '1', '1', 'qwq'), ('12', 'qqq', '11', '1', '1', '1', 'qwq'), ('13', 'qqq', '11', '3', '1', '1', 'qwq'), ('14', 'qqq', '11', '3', '1', '1', 'qwq'), ('15', 'zzq', '11', '2', '1', '1', 'qwq'), ('16', 'zz2q', '11', '2', '1', '1', 'qwq'), ('17', 'zz233q', '11', '1', '1', '1', 'qwq'), ('18', '4zz233q', '11', '1', '1', '1', 'qwq'), ('19', '4zz2333q', '11', '1', '1', '1', 'qwq');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
